home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / src / linux-headers-2.6.28-15 / include / linux / serial.h < prev    next >
Encoding:
C/C++ Source or Header  |  2009-09-09  |  5.6 KB  |  199 lines

  1. /*
  2.  * include/linux/serial.h
  3.  *
  4.  * Copyright (C) 1992 by Theodore Ts'o.
  5.  * 
  6.  * Redistribution of this file is permitted under the terms of the GNU 
  7.  * Public License (GPL)
  8.  */
  9.  
  10. #ifndef _LINUX_SERIAL_H
  11. #define _LINUX_SERIAL_H
  12.  
  13. #include <linux/types.h>
  14.  
  15. #ifdef __KERNEL__
  16. #include <asm/page.h>
  17.  
  18. /*
  19.  * Counters of the input lines (CTS, DSR, RI, CD) interrupts
  20.  */
  21.  
  22. struct async_icount {
  23.     __u32    cts, dsr, rng, dcd, tx, rx;
  24.     __u32    frame, parity, overrun, brk;
  25.     __u32    buf_overrun;
  26. };
  27.  
  28. /*
  29.  * The size of the serial xmit buffer is 1 page, or 4096 bytes
  30.  */
  31. #define SERIAL_XMIT_SIZE PAGE_SIZE
  32.  
  33. #endif
  34.  
  35. struct serial_struct {
  36.     int    type;
  37.     int    line;
  38.     unsigned int    port;
  39.     int    irq;
  40.     int    flags;
  41.     int    xmit_fifo_size;
  42.     int    custom_divisor;
  43.     int    baud_base;
  44.     unsigned short    close_delay;
  45.     char    io_type;
  46.     char    reserved_char[1];
  47.     int    hub6;
  48.     unsigned short    closing_wait; /* time to wait before closing */
  49.     unsigned short    closing_wait2; /* no longer used... */
  50.     unsigned char    *iomem_base;
  51.     unsigned short    iomem_reg_shift;
  52.     unsigned int    port_high;
  53.     unsigned long    iomap_base;    /* cookie passed into ioremap */
  54. };
  55.  
  56. /*
  57.  * For the close wait times, 0 means wait forever for serial port to
  58.  * flush its output.  65535 means don't wait at all.
  59.  */
  60. #define ASYNC_CLOSING_WAIT_INF    0
  61. #define ASYNC_CLOSING_WAIT_NONE    65535
  62.  
  63. /*
  64.  * These are the supported serial types.
  65.  */
  66. #define PORT_UNKNOWN    0
  67. #define PORT_8250    1
  68. #define PORT_16450    2
  69. #define PORT_16550    3
  70. #define PORT_16550A    4
  71. #define PORT_CIRRUS     5    /* usurped by cyclades.c */
  72. #define PORT_16650    6
  73. #define PORT_16650V2    7
  74. #define PORT_16750    8
  75. #define PORT_STARTECH    9    /* usurped by cyclades.c */
  76. #define PORT_16C950    10    /* Oxford Semiconductor */
  77. #define PORT_16654    11
  78. #define PORT_16850    12
  79. #define PORT_RSA    13    /* RSA-DV II/S card */
  80. #define PORT_MAX    13
  81.  
  82. #define SERIAL_IO_PORT    0
  83. #define SERIAL_IO_HUB6    1
  84. #define SERIAL_IO_MEM    2
  85.  
  86. struct serial_uart_config {
  87.     char    *name;
  88.     int    dfl_xmit_fifo_size;
  89.     int    flags;
  90. };
  91.  
  92. #define UART_CLEAR_FIFO        0x01
  93. #define UART_USE_FIFO        0x02
  94. #define UART_STARTECH        0x04
  95. #define UART_NATSEMI        0x08
  96.  
  97. /*
  98.  * Definitions for async_struct (and serial_struct) flags field
  99.  */
  100. #define ASYNC_HUP_NOTIFY 0x0001 /* Notify getty on hangups and closes 
  101.                    on the callout port */
  102. #define ASYNC_FOURPORT  0x0002    /* Set OU1, OUT2 per AST Fourport settings */
  103. #define ASYNC_SAK    0x0004    /* Secure Attention Key (Orange book) */
  104. #define ASYNC_SPLIT_TERMIOS 0x0008 /* Separate termios for dialin/callout */
  105.  
  106. #define ASYNC_SPD_MASK    0x1030
  107. #define ASYNC_SPD_HI    0x0010    /* Use 56000 instead of 38400 bps */
  108.  
  109. #define ASYNC_SPD_VHI    0x0020  /* Use 115200 instead of 38400 bps */
  110. #define ASYNC_SPD_CUST    0x0030  /* Use user-specified divisor */
  111.  
  112. #define ASYNC_SKIP_TEST    0x0040 /* Skip UART test during autoconfiguration */
  113. #define ASYNC_AUTO_IRQ  0x0080 /* Do automatic IRQ during autoconfiguration */
  114. #define ASYNC_SESSION_LOCKOUT 0x0100 /* Lock out cua opens based on session */
  115. #define ASYNC_PGRP_LOCKOUT    0x0200 /* Lock out cua opens based on pgrp */
  116. #define ASYNC_CALLOUT_NOHUP   0x0400 /* Don't do hangups for cua device */
  117.  
  118. #define ASYNC_HARDPPS_CD    0x0800    /* Call hardpps when CD goes high  */
  119.  
  120. #define ASYNC_SPD_SHI    0x1000    /* Use 230400 instead of 38400 bps */
  121. #define ASYNC_SPD_WARP    0x1010    /* Use 460800 instead of 38400 bps */
  122.  
  123. #define ASYNC_LOW_LATENCY 0x2000 /* Request low latency behaviour */
  124.  
  125. #define ASYNC_BUGGY_UART  0x4000 /* This is a buggy UART, skip some safety
  126.                   * checks.  Note: can be dangerous! */
  127.  
  128. #define ASYNC_AUTOPROBE     0x8000 /* Port was autoprobed by PCI or PNP code */
  129.  
  130. #define ASYNC_FLAGS    0x7FFF    /* Possible legal async flags */
  131. #define ASYNC_USR_MASK    0x3430    /* Legal flags that non-privileged
  132.                  * users can set or reset */
  133.  
  134. /* Internal flags used only by kernel/chr_drv/serial.c */
  135. #define ASYNC_INITIALIZED    0x80000000 /* Serial port was initialized */
  136. #define ASYNC_NORMAL_ACTIVE    0x20000000 /* Normal device is active */
  137. #define ASYNC_BOOT_AUTOCONF    0x10000000 /* Autoconfigure port on bootup */
  138. #define ASYNC_CLOSING        0x08000000 /* Serial port is closing */
  139. #define ASYNC_CTS_FLOW        0x04000000 /* Do CTS flow control */
  140. #define ASYNC_CHECK_CD        0x02000000 /* i.e., CLOCAL */
  141. #define ASYNC_SHARE_IRQ        0x01000000 /* for multifunction cards
  142.                          --- no longer used */
  143. #define ASYNC_CONS_FLOW        0x00800000 /* flow control for console  */
  144.  
  145. #define ASYNC_BOOT_ONLYMCA    0x00400000 /* Probe only if MCA bus */
  146. #define ASYNC_INTERNAL_FLAGS    0xFFC00000 /* Internal flags */
  147.  
  148. /*
  149.  * Multiport serial configuration structure --- external structure
  150.  */
  151. struct serial_multiport_struct {
  152.     int        irq;
  153.     int        port1;
  154.     unsigned char    mask1, match1;
  155.     int        port2;
  156.     unsigned char    mask2, match2;
  157.     int        port3;
  158.     unsigned char    mask3, match3;
  159.     int        port4;
  160.     unsigned char    mask4, match4;
  161.     int        port_monitor;
  162.     int    reserved[32];
  163. };
  164.  
  165. /*
  166.  * Serial input interrupt line counters -- external structure
  167.  * Four lines can interrupt: CTS, DSR, RI, DCD
  168.  */
  169. struct serial_icounter_struct {
  170.     int cts, dsr, rng, dcd;
  171.     int rx, tx;
  172.     int frame, overrun, parity, brk;
  173.     int buf_overrun;
  174.     int reserved[9];
  175. };
  176.  
  177. /*
  178.  * Serial interface for controlling RS485 settings on chips with suitable
  179.  * support. Set with TIOCSRS485 and get with TIOCGRS485 if supported by your
  180.  * platform. The set function returns the new state, with any unsupported bits
  181.  * reverted appropriately.
  182.  */
  183.  
  184. struct serial_rs485 {
  185.     __u32    flags;            /* RS485 feature flags */
  186. #define SER_RS485_ENABLED        (1 << 0)
  187. #define SER_RS485_RTS_ON_SEND        (1 << 1)
  188. #define SER_RS485_RTS_AFTER_SEND    (1 << 2)
  189.     __u32    delay_rts_before_send;    /* Milliseconds */
  190.     __u32    padding[6];        /* Memory is cheap, new structs
  191.                        are a royal PITA .. */
  192. };
  193.  
  194. #ifdef __KERNEL__
  195. #include <linux/compiler.h>
  196.  
  197. #endif /* __KERNEL__ */
  198. #endif /* _LINUX_SERIAL_H */
  199.